/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package klasy;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cyga
 */
@Entity
@Table(name = "lekarz", catalog = "pai1", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Lekarz.findAll", query = "SELECT l FROM Lekarz l"),
    @NamedQuery(name = "Lekarz.findByIdLekarz", query = "SELECT l FROM Lekarz l WHERE l.idLekarz = :idLekarz"),
    @NamedQuery(name = "Lekarz.findByImie", query = "SELECT l FROM Lekarz l WHERE l.imie = :imie"),
    @NamedQuery(name = "Lekarz.findByNaziwsko", query = "SELECT l FROM Lekarz l WHERE l.naziwsko = :naziwsko"),
    @NamedQuery(name = "Lekarz.findByTelefon", query = "SELECT l FROM Lekarz l WHERE l.telefon = :telefon")})
public class Lekarz implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_lekarz")
    private Integer idLekarz;
    @Column(name = "imie")
    private String imie;
    @Column(name = "naziwsko")
    private String naziwsko;
    @Column(name = "telefon")
    private Integer telefon;
    @OneToMany(mappedBy = "idLekarz", fetch = FetchType.EAGER)
    private Set<Choroba> chorobaSet;

    public Lekarz() {
    }

    public Lekarz(Integer idLekarz) {
        this.idLekarz = idLekarz;
    }

    public Integer getIdLekarz() {
        return idLekarz;
    }

    public void setIdLekarz(Integer idLekarz) {
        this.idLekarz = idLekarz;
    }

    public String getImie() {
        return imie;
    }

    public void setImie(String imie) {
        this.imie = imie;
    }

    public String getNaziwsko() {
        return naziwsko;
    }

    public void setNaziwsko(String naziwsko) {
        this.naziwsko = naziwsko;
    }

    public Integer getTelefon() {
        return telefon;
    }

    public void setTelefon(Integer telefon) {
        this.telefon = telefon;
    }

    @XmlTransient
    public Set<Choroba> getChorobaSet() {
        return chorobaSet;
    }

    public void setChorobaSet(Set<Choroba> chorobaSet) {
        this.chorobaSet = chorobaSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLekarz != null ? idLekarz.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lekarz)) {
            return false;
        }
        Lekarz other = (Lekarz) object;
        if ((this.idLekarz == null && other.idLekarz != null) || (this.idLekarz != null && !this.idLekarz.equals(other.idLekarz))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return naziwsko;
    }
    
}
